package com.kemai.designmode.entry.fruit

/**
 *@description:水果套餐类
 * @author: zhaoshanshan
 * @date: 2022/10/3 3:07 下午

 */
class FruitMeal {

     lateinit var apple:Apple//苹果
     lateinit var banana:Banana//香蕉
     lateinit var orange:Orange//桔子
     var discount:Double = 0.0 //折扣价
     var totalCount:Double = 0.0

    fun calculateTotalCount(){
        if(null!=apple){
            totalCount +=  apple.price
        }
        if(null!=banana){
            totalCount +=  banana.price
        }
        if(null!=orange){
            totalCount +=  orange.price
        }
        totalCount -= discount
    }
}